﻿<%@ Page Title="Title" Language="C#" Inherits="System.Web.Mvc.ViewPage<object>" MasterPageFile="~/Views/Shared/Site.Master" %>
<asp:Content runat="server" ID="Title" ContentPlaceHolderID="TitleContent"></asp:Content>
<asp:Content runat="server" ID="Main" ContentPlaceHolderID="MainContent">
<h3>AjaxCheckboxList</h3>

<p class="te">
This control is like the AjaxDropdown, has all the features, except you select many instead of one value.<br/>
Example:
</p>
<pre class="prettyprint">
&lt;o:AjaxCheckboxList runat=&quot;server&quot; ID=&quot;SimpleCategories&quot; Url=&quot;~/svc/aja.svc/CategoriesCheckboxList&quot;&gt;&lt;/o:AjaxCheckboxList&gt;
</pre>
<pre class="prettyprint">
[WebGet]
[OperationContract]
public IEnumerable&lt;SelectListItem&gt; CategoriesCheckboxList(string v)
{
    var keys = v.GetIntArray();
    return Categories
        .Select(o =&gt; new SelectListItem
        {
            Value = o.Id,
            Text = o.Name,
            Selected = keys.Contains(o.Id)
        });
}
</pre>

<p class="te"> getting and setting the value of the AjaxCheckboxList is done the same way as for the <a href="<%=Url.Action("MultiLookup") %>#getsetvalue">MultiLookup</a></p>

<script type="text/javascript">
    $(function () {
        prettyPrint();
    });
</script>





</asp:Content>
